var transObj = {
    data:{
        hp_ids:""
    }
}

layui.define(['element','layer', 'table', 'form','admin','ax','upload','func','laydate','formSelects'], function (exports) {
    var $ = layui.$;
    var table = layui.table;
    var $ax = layui.ax;
    var admin = layui.admin;
    var form = layui.form;
    var layer = layui.layer;
    var func = layui.func;
    var laydate = layui.laydate;
    var element = layui.element;
    var formSelects=layui.formSelects;

    //获取传参---------------------------------------------------------------
    var page_type = "";
    var btyZxChengbenId=Feng.getUrlParam("btyZxChengbenId");
    //alert(btyZxChengbenId==null);
    if(btyZxChengbenId=="" || btyZxChengbenId=="undefined" ||btyZxChengbenId==null){
        btyZxChengbenId = "-1";
        page_type="add"
    }else {
        page_type="update";
    }
    //获取成本详情信息，填充门店选择框
    var result = null;
    var riqi_val = null;

    function GetQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURI(r[2]); return null;
    }
    var riqi = GetQueryString("riqi");
    var zongjia=GetQueryString("zongjia");


    function loadPage() {
        var ajax = new $ax(Feng.ctxPath + "/zxBx/detail?btyZxChengbenId=" + btyZxChengbenId);
        if(page_type=="update"){
            result = ajax.start();
            result.data.riqi=result.data.riqi.substring(0,10);
            form.val('zxChengbenForm', result.data);
            riqi_val = result.data.riqi;
        }else {
            riqi_val = Feng.currentDate();
        }
    }
    loadPage();
    function detail() {
        var ajax = new $ax(Feng.ctxPath + "/zxBx/detail?btyZxChengbenId=" + btyZxChengbenId);
        if(page_type=="update"){
            result = ajax.start();
            result.data.riqi=result.data.riqi.substring(0,10);
            form.val('zxChengbenForm', result.data);
        }

    }

    if(riqi) {
        $('#riqi').val(riqi)
    }
    if(zongjia) {
        $('#zongjia').val(zongjia)
    }

    /**
     * 成本明细对象
     */
    var ZxChengbenMingxi = {
        tableId: "bxMingxiTable"
    };

    /**
     * 初始化表格的列
     */
    ZxChengbenMingxi.initColumn = function () {
        return [[
            // {type: 'checkbox'},
            // {field: 'dh',width: 180,sort: true, title: '报销单号' },
            // {field: 'btyyBxdaIdView',width: 100, sort: true, title: '报销人'},
            // {
            //     field: 'createTime', width: 110, sort: true, title: '提交日期', templet: function (data) {
            //         return layui.util.toDateString(data.createTime, "yyyy-MM-dd");
            //     }
            // },
            {field: 'btyZxChengbenMingxiId', hide: true, title: ''},
            // {field: 'btyBrandIdView', width: 250, sort: true, title: '门店'},
            // {field: 'btyZxMdzxId', sort: true, title: '门店id',hide: true},
            // {field: 'btyZxKemuIdView', sort: true, title: '科目'},
            {field: 'qtkm', sort: true, title: '货品'},
            {field: 'shuliang', sort: true,width: 90, title: '数量',edit: 'text'},
            {field: 'unitPrice', sort: true,width: 90, title: '单价',edit: 'text'},
            {field: 'bxjine', sort: true,width: 120, title: '金额',totalRow: true},
            {field: 'beizhu', sort: true, title: '备注',edit: 'text'},
            {field: 'status', templet: '#statusTpl2',sort: true, title: '状态',width: 120},
            // {field: 'gongshi', sort: true, title: '公式',totalRow: true},
            // {field: 'status', sort: true, title: '状态'},
            // {field: 'statusView', sort: true, title: '状态显示'},
            // {field: 'delFlag', sort: true, title: ''},
            // {field: 'createUser', sort: true, title: ''},
            // {field: 'createUserName', sort: true, title: ''},
            // {field: 'createTime', sort: true, title: ''},
            // {field: 'updateUser', sort: true, title: ''},
            // {field: 'updateUserName', sort: true, title: ''},
            // {field: 'updateTime', sort: true, title: ''},
            // {field: 'company', sort: true, title: ''},
            // {field: 'srcType', sort: true, title: ''},
            // {field: 'srcValue', sort: true, title: ''},
            {align: 'center', toolbar: '#tableBar', title: '操作'}
        ]];
    };

    // 渲染表格
    var tableResult = table.render({
        elem: '#' + ZxChengbenMingxi.tableId,
        //参数来自zxChengben.js
        url: Feng.ctxPath + '/zxBxMingxi/list',
        page: false,
        height: "full-128",
        cellMinWidth: 100,
        totalRow: true,
        limit: 90,
        where:{
            btyZxChengbenId:btyZxChengbenId
        },
        cols: ZxChengbenMingxi.initColumn()
    });

//zxChengbenMingxiTable
    //监听单元格编辑bxMingxiTable
    table.on('edit(bxMingxiTable)', function (obj) {
        //得到修改后的值
        var value = obj.value,
            //得到所在行所有键值
            data = obj.data,
            //得到字段
            field = obj.field;
        if (field == "shuliang" && isNaN(value)) {
            Feng.error("修改失败，数量必须填写数字");
            return false;
        }
        //金额字段校验
        if (field == "unitPrice" && isNaN(value)) {
            Feng.error("修改失败，单价必须填写数字");
            return false;
        }

        var shuliang = data.shuliang;
        var unitPrice = data.unitPrice;
        var jine = shuliang * unitPrice;
        data.jine=jine;
        data.bxjine=jine;
        $.ajax({
            type: "PUT",
            url: "/zxBxMingxi/editItemGhs",
            datatype: "json",
            data: data,
            success: function (data) {
                if (data.code != 200) {
                    Feng.error(data.message);
                    table.reload(ZxChengbenMingxi.tableId);

                }else {
                    table.reload(ZxChengbenMingxi.tableId);
                }
                loadPage();
            }, error: function () {
                Feng.error("修改失败！");
            }, complete: function (XHR, TS) {
            }
        });
    });

    // 工具条点击事件
    table.on('tool(' + ZxChengbenMingxi.tableId + ')', function (obj) {
        var data = obj.data;
        var layEvent = obj.event;

        if (layEvent === 'edit') {
            ZxChengbenMingxi.openEditDlg(data);
        } else if (layEvent === 'delete') {
            ZxChengbenMingxi.onDeleteItem(data);
        }
    });

    //初始化控件
    ZxChengbenMingxi.initWidget=function(){
        laydate.render({
            elem: '#riqi',
            format: 'yyyy-MM-dd',
            value:riqi_val,
            max: Feng.currentDate()
        });
    }
    ZxChengbenMingxi.initWidget();


    form.verify({
        double: function (value) {
            var patt2=/^(\-|\+)?\d+(\.\d+)?$/;
            if (patt2.test(value) == false) {
                return '你输入的不是数字';
            }
        }
    });







    /**
     * 点击查询按钮
     */
    ZxChengbenMingxi.search = function () {
        var queryData = {};
        queryData['btyZxChengbenId'] = $("#btyZxChengbenId").val();
        table.reload(ZxChengbenMingxi.tableId, {where: queryData});
    };

    /**
     * 弹出添加对话框
     */
    ZxChengbenMingxi.openAddDlg = function () {
        window.location.href = Feng.ctxPath + '/zxBxMingxi/add';
    };

    ZxChengbenMingxi.openAddDlg1 = function () {
        //window.location.href = Feng.ctxPath + '/zxBxMingxi/add';
        var btyZxMdzxId=$("#btyZxMdzxId").val();
        var zy=$("#zhaiyao").val();
        var bz=$("#beizhu1").val();
        var riqi=$("#riqi").val();

        var url = Feng.ctxPath + '/zxBxMingxi/index_huopin?btyZxMdzxId='+btyZxMdzxId+'&zhaiyao='+zy+'&beizhu='+bz+'&riqi='+riqi;

        layer.open({
            type: 2,
            title: '选择货品',
            area: ['50%', '50%'],
            content: url,
            end: function () {
                //ZxChengben.search();
                // window.location.reload();
                alert(transObj.data.hp_ids);
            },
            cancel:function (index){
                //ZxChengben.search();
                // window.location.reload();
            }
        });
    };


    /**
     * 点击编辑
     *
     * @param data 点击按钮时候的行数据
     */
    ZxChengbenMingxi.openEditDlg = function (data) {
        var btyZxMdzxId = $("#btyZxMdzxId").val();
        var url = Feng.ctxPath + '/zxBxMingxi/editGhs?btyZxChengbenMingxiId=' + data.btyZxChengbenMingxiId+"&btyZxChengbenId="+data.btyZxChengbenId
            +"&btyZxKemuId="+data.btyZxKemuId+"&btyZxKemuIdView="+encodeURIComponent(data.btyZxKemuIdView)+"&btyZxMdzxId="+btyZxMdzxId;
        // window.location.href = url;

        parent.layer.open({
            type: 2,
            title: '修改报销明细',
            area: ['800px', '800px'],
            content: url,
            end: function () {
                ZxChengbenMingxi.search();
                loadPage();
            },
            cancel:function (index){
                ZxChengbenMingxi.search();
            }
        });

    };

    /**
     * 点击删除
     *
     * @param data 点击按钮时候的行数据
     */
    ZxChengbenMingxi.onDeleteItem = function (data) {
        var operation = function () {
            var ajax = new $ax(Feng.ctxPath + "/zxBxMingxi/deleteGhs", function (data) {
                if (data.code == 200) {
                    Feng.success("删除成功!");
                    table.reload(ZxChengbenMingxi.tableId);
                    init_btyZxChengbenId();
                    detail();
                }else {
                    Feng.error("删除失败!");
                }
            }, function (data) {
                Feng.error("删除失败!" + data.responseJSON.message + "!");
            });
            ajax.set("btyZxChengbenMingxiId", data.btyZxChengbenMingxiId);
            ajax.start();
        };
        Feng.confirm("是否删除?", operation);
    };



    // 搜索按钮点击事件
    $('#btnSearch').click(function () {
        ZxChengbenMingxi.search();
    });

    // 添加按钮点击事件
    $('#btnAdd').click(function () {
        ZxChengbenMingxi.openAddDlg();
    });

    $('#btnAdd1').click(function () {
        var btyZxMdzxId=$("#btyZxMdzxId").val();
        if(btyZxMdzxId==""){
            Feng.error("请先选择门店!");
            return false;
        }else{
            ZxChengbenMingxi.openAddDlg1();
        }

    });

    function saveHead(data){
        //保存之前判断一下门店是否被锁定
        var btyZxMdzxId=$("#btyZxMdzxId1").val();
        var ajax = new $ax(Feng.ctxPath + "/zxBx/lockList?btyZxMdzxId=" + btyZxMdzxId);
        result = ajax.start();
        if(result.code==502){
            Feng.error(result.message);
            return;
        }
        var url = null;
        if(page_type=="add"){
            url = Feng.ctxPath + "/zxBx/addItem";
        }else{
            url = Feng.ctxPath + "/zxBx/editItem";
        }
        var ajax = new $ax(url, function (r) {
            Feng.success("保存成功！");
            form.val('zxChengbenForm', r.data);
            page_type="update";
        }, function (data) {
            Feng.error("添加失败！" + data.responseJSON.message)
        });
        ajax.set(data.field);
        ajax.set("status","4");
        ajax.start();
    }

    form.on('submit(saveHead)', function (data) {

        //保存之前判断一下门店是否被锁定
        var btyZxMdzxId=$("#btyZxMdzxId1").val();
        var ajax = new $ax(Feng.ctxPath + "/zxBx/lockList?btyZxMdzxId=" + btyZxMdzxId);
        result = ajax.start();
        if(result.code==502){
            Feng.error(result.message);
            return;
        }
        //result.data.riqi = result.data.riqi.substring(0, 10);

        var url = null;
        if(page_type=="add"){
            url = Feng.ctxPath + "/zxBx/addItem";
        }else{
            url = Feng.ctxPath + "/zxBx/editItem";
        }
        var ajax = new $ax(url, function (r) {
            Feng.success("保存成功！");
            form.val('zxChengbenForm', r.data);
            page_type="update";
        }, function (data) {
            Feng.error("添加失败！" + data.responseJSON.message)
        });
        ajax.set(data.field);
        ajax.set("status","4");
        ajax.start();
        return false;
    });


    form.on('submit(btnSubmitHead)', function (data) {
        //保存之前判断一下门店是否被锁定
        var btyZxMdzxId=$("#btyZxMdzxId1").val();
        var ajax = new $ax(Feng.ctxPath + "/zxBx/lockList?btyZxMdzxId=" + btyZxMdzxId);
        result = ajax.start();
        if(result.code==502){
            Feng.error(result.message);
            return;
        }
        var zy=$("#zhaiyao").val();
        if(zy==""){
            Feng.error("摘要为空，不能提交报销单！");
            return;
        }
        saveHead(data);
        var operation = function () {
            $.ajax({
                url: Feng.ctxPath + "/zxBxMingxi/tijiaobaoxiaoGhs",
                cache: false,
                dataType:"json",
                data:  {
                    'btyZxChengbenId':btyZxChengbenId
                },
                timeout: 600*1000,//10min
                beforeSend: function () {

                },
                success: function (data) {
                    if (data.code == 200) {
                        Feng.success("提交成功!");
                        returnPage();
                    }else {
                        Feng.error(data.message);
                    }
                },
                error: function (data) {
                    layer.alert('失败！');
                }
            });





        };
        Feng.confirm("是否提交?", operation);
        return false;
    });

    form.on('submit(btnSubmit)', function (data) {
        //保存之前判断一下门店是否被锁定
        var btyZxMdzxId=$("#btyZxMdzxId1").val();
        var ajax = new $ax(Feng.ctxPath + "/zxBx/lockList?btyZxMdzxId=" + btyZxMdzxId);
        result = ajax.start();
        if(result.code==502){
            Feng.error(result.message);
            return;
        }

        var datahd = form.val('zxChengbenForm');
        if(datahd.btyZxMdzxId==""){
            Feng.error("门店未选择！")
            return;
        }
        var allData = table.cache["bxMingxiTable"];
        for(var i=0;i<allData.length;i++){
            var obj = allData[i];
            var huopinId = obj.huopinId;
            if(data.field.huopinId==huopinId){
                Feng.error("此货品已添加，不能重复添加！")
                return;
            }
        }

        //判断货品是否存在

        var ajax = new $ax(Feng.ctxPath + "/zxBxMingxi/addItemGhs", function (data) {
            if (data.code == 200) {
                // Feng.success("保存成功");
                btyZxChengbenId=data.data.btyZxChengbenId;
                $("#zxChengbenForm input[name=btyZxChengbenId]").val(data.data.btyZxChengbenId);

                page_type="update";
                $("#unitPrice").val("");
                $("#jine").val("");
                $("#beizhu").val("");
                $("#huopinId").val("");
                // $("#shuliang").val("");
                $("#bxjine").val("");
                $("#beizhu").val("");
                form.render('select');
                //刷新列表
                var queryData = {};
                queryData['btyZxChengbenId'] = btyZxChengbenId;
                table.reload(ZxChengbenMingxi.tableId, {where: queryData});
                //获取合计数据
                $("#msg").html(data.message);
            }else {
                Feng.error(data.message);
            }
        }, function (data) {
            Feng.error("添加失败！" + data.responseJSON.message)
        });

        ajax.set(data.field);
        ajax.set("btyZxChengbenId",btyZxChengbenId);
        ajax.set("status","4");

        var zy=$("#zhaiyao").val();
        var bz=$("#beizhu1").val();
        var rq=$("#riqi").val();
        //携带主表信息
        ajax.set("head.btyZxChengbenId",btyZxChengbenId);
        ajax.set("head.btyyBxdaId",datahd.btyyBxdaId);
        ajax.set("head.btyyBxdaIdView",datahd.btyyBxdaIdView);
        ajax.set("head.yhKahao",datahd.yhKahao);
        ajax.set("head.yhKaihuhang",datahd.yhKaihuhang);
        ajax.set("head.company",datahd.company);
        ajax.set("head.btyZxMdzxId",datahd.btyZxMdzxId);
        ajax.set("head.zhaiyao",zy);
        ajax.set("head.beizhu",bz);
        ajax.set("head.riqi",rq);
        ajax.set("head.status","4");

        var zongjia = parseFloat(datahd.zongjia);
        if(isNaN(zongjia)){
            zongjia=0;
        }
        var jine = parseFloat(data.field.jine);
        if(isNaN(jine)){
            jine=0
        }
        var zongjia_n = zongjia+jine;
        $("#zxChengbenForm input[name=zongjia]").val(zongjia_n);

        ajax.set("head.zongjia",zongjia_n);
        ajax.start();
        return false;
    });


    function closePage(){
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }

    //返回按钮
    $("#backupPage").click(function () {
        returnPage();
    });




    function init_btyZxChengbenId() {
        $("#btyZxChengbenId").empty();
        $("#btyZxChengbenId").append("<option value=''>请选择</option>");
        var languageAjax = new $ax(Feng.ctxPath + "/zxBx/list");
        languageAjax.set("btyyBxdaId",$("#btyyBxdaId").val());
        var languageResult = languageAjax.start();
        $.each(languageResult.data, function (index, val) {
            if(val.company!=undefined){
                //添加的门店
                $("#btyZxChengbenId").append("<option value='" + val.btyZxChengbenId + "'>" + val.company  + "</option>");
            }
        });
        form.render('select');
    }
    //init_btyZxChengbenId();
    /**
     * 初始门店
     */
    function init_btyZxMdzxId1(){
        $("#btyZxMdzxId").empty();
        $("#btyZxMdzxId").append("<option value=''>请选择</option>");
        var languageAjax = new $ax(Feng.ctxPath + "/mdzx/ghsList");
        var languageResult = languageAjax.start();
        $.each(languageResult.data, function (index, val) {
            if(val.btyBrandIdView!=undefined){
                var pinyin = ConvertPinyin(val.btyBrandIdView);
                //添加的门店
                // $("#btyZxMdzxId").append("<option value='" + val.btyZxMdzxId + "'>" + val.btyBrandIdView  + "</option>");

                //查询用的门店
                $("#btyZxMdzxId1").append("<option value='" + val.btyZxMdzxId + "'>" + val.btyBrandIdView + "</option>");
            }
        });
        if(result!=null){
            $("#btyZxMdzxId1").val(result.data.btyZxMdzxId);
        }
        form.render('select');
    }
    init_btyZxMdzxId1();


    //金额与公式联动
    $("#jine").on("input",function(e){
        var jine=$("#jine").val();
        $("#gongshi").val("");
        if(jine!=""){
            $("#gongshi").val(jine);
        }
    });

    /**
     * 初始化厂家-报销人
     */


    function init_btyyBxdaId() {
        $("#btyyBxdaId").empty();
        $("#btyyBxdaId").append("<option value=''>请选择</option>");

        var languageAjax = new $ax(Feng.ctxPath + "/btyBxda/getAllVendorList");
        var languageResult = languageAjax.start();
        $.each(languageResult.data, function (index, val) {
            var pinyin = ConvertPinyin(val.xm);

            $("#btyyBxdaId").append("<option value='" + val.yhk + "'>" + val.xm +"-"+ val.yhk+"-"+ pinyin + "</option>");
        });
        form.render('select');
    }

    var huopinArr = null;
    /**
     * 初始关键字-其它科目-三级科目
     */
    function init_huopinId(){
        $("#huopinId").empty();
        $("#huopinId").append("<option value=''>请选择</option>");
        var languageAjax = new $ax(Feng.ctxPath + "/zxHuopin/ghsList");
        languageAjax.set("ghs",$("#btyyBxdaKey").val());
        var languageResult = languageAjax.start();
        huopinArr=languageResult;
        $.each(languageResult, function (index, val) {
            if(val.btyZxHuopinId!=undefined){
                $("#huopinId").append("<option value='" + val.btyZxHuopinId + "'>" + val.name+ "</option>");
            }
        });
        //form.render('select');
        formSelects.render('huopinId');
    }
    init_huopinId();

    //选择货品时，将货品名称赋值给摘要
    form.on('select(huopinId)',function (data) {
        var huopinId= $("#huopinId").val();
        if(huopinId!="") {
            $.each(huopinArr, function (index, val) {
                if(val.btyZxHuopinId==huopinId){
                    $("#qtkm").val(val.name);
                    $("#unitPrice").val(val.danjia);
                    calJe();
                }
            });
        }
    });

    function init_createUser(){
        $("#createUser").empty();
        $("#createUser").append("<option value=''>全部</option>");
        var languageAjax = new $ax(Feng.ctxPath + "/zxBxMingxi/queryCreateUser");
        var languageResult = languageAjax.start();
        console.info(languageResult);
        var userid = languageResult.data.userid;
        $.each(languageResult.data.list, function (index, val) {
            var selected = "";
            if(val.value==userid){
                selected = "selected";
            }
            $("#createUser").append("<option value='" + val.value + "' "+selected+">" + val.label + "</option>");
        });
        form.render('select');
    }
    init_createUser();

    function calJe(){
        var shuliang = $("#shuliang").val();
        var unitPrice = $("#unitPrice").val();
        if(unitPrice==""){
            $("#bxjine").val("");
            return;
        }
        var bxjine = shuliang * unitPrice;
        $("#bxjine").val(bxjine.toFixed(2));
        $("#jine").val(bxjine.toFixed(2));
    }

    $("#shuliang").blur(function (data) {
        calJe();
    });
    $("#unitPrice").blur(function (data) {
        calJe();
    });



    // 添加按钮点击事件
    $('#gjz_sx').click(function () {
        init_huopinId();
    });
    $('#bxr_sx').click(function () {
        init_btyyBxdaId()
    });
    $('#md_sx').click(function () {
        init_btyZxMdzxId()
    });


    // 添加按钮点击事件
    $('#kemuKeyAdd').click(function () {
        layer.open({
            type: 2,
            title: '添加科目关键字', //不显示标题(false)
            shadeClose: true,
            shade: false,
            maxmin: true, //开启最大化最小化按钮
            area: ['60%', '60%'],
            end: function (index) {
                //刷新
                init_huopinId();
            },
            content: Feng.ctxPath + '/zxKemuKey'
        });


    });



    //重新加载报销人select
    ZxChengbenMingxi.reloadSelect = function (newyinhangka) {
        $("#btyyBxdaId").html("");
        $("#btyyBxdaId").append("<option value=''>" + "请选择"+"</option>");
        var languageAjax = new $ax(Feng.ctxPath + "/btyBxda/getAllVendorList");
        var languageResult = languageAjax.start();
        console.info(languageResult);

        $.each(languageResult.data, function (index, val) {
            var pinyin = ConvertPinyin(val.xm);
            $("#btyyBxdaId").append("<option value='" + val.yhk + "'>" + val.xm +"-"+ val.yhk+"-"+ pinyin + "</option>");
        });
        $("#btyyBxdaId").val(newyinhangka);
        form.render('select');
    };

    // 刷新页面
    $('#refresh').click(function () {
        window.location.href = Feng.ctxPath + '/zxBx/index_ghs';
    });

    function returnPage(){
        window.location.href = Feng.ctxPath + '/zxBx/index_ghs';
    }


    //提交
    $('#createDakuandan1').click(function () {

        var zy=$("#zhaiyao").val();
        if(zy==""){
            Feng.error("摘要为空，不能提交报销单！");
            return;
        }


        var operation = function () {
            $.ajax({
                url: Feng.ctxPath + "/zxBxMingxi/tijiaobaoxiaoGhs",
                cache: false,
                dataType:"json",
                data:  {
                    'btyZxChengbenId':btyZxChengbenId
                },
                timeout: 600*1000,//10min
                beforeSend: function () {

                },
                success: function (data) {
                    if (data.code == 200) {
                        Feng.success("提交成功!");
                        returnPage();
                    }else {
                        Feng.error(data.message);
                    }
                },
                error: function (data) {
                    layer.alert('失败！');
                }
            });
        };
        Feng.confirm("是否提交?", operation);
    });

    $('#createDakuandan2').click(function () {
        var operation = function () {
            $.ajax({
                url: Feng.ctxPath + "/zxBxMingxi/tijiaobaoxiaoGhsTh",
                cache: false,
                dataType:"json",
                data:  {'btyyBxdaId':$("#btyyBxdaId").val()},
                timeout: 600*1000,//10min
                beforeSend: function () {

                },
                success: function (data) {
                    if (data.code == 200) {
                        Feng.success("提交成功!");
                        //刷新列表
                        var queryData = {};
                        queryData['btyZxMdzxId'] = Feng.getUrlParam("btyZxMdzxId");
                        table.reload(ZxChengbenMingxi.tableId, {where: queryData});
                        init_btyZxChengbenId();
                    }else {
                        Feng.error(data.message);
                    }
                },
                error: function (data) {
                    layer.alert('失败！');

                }
            });
        };
        Feng.confirm("是否提交报销?", operation);
    });


    $('#btnQingkong').click(function () {
        $("#btyZxMdzxId").val("");
        $("#huopinId").val("");
        form.render('select');
        $("#shuliang").val("1");
        $("#unitPrice").val("");
        $("#jine").val("");
        $("#beizhu").val("");
    });



});
